function [rings main] = SMILES(input,GUI)
% The CORE-application of SMILES. This function runs all other functions,
% and passes on the results to the right programme. Input contains the
% SMILES-string, while GUI indicates whether or not (1 = used) the GUI is being used.

%% set GUI
if ~(exist('GUI','var') == 1)
    GUI = 0; %A marker which tells some functions below a GUI is not being used.
end

%% Calculations
% Runs all calculation functions, and stores them in a struct called main.
main = getBonds(readPiece(input,[],1));
% A special function is used to determine the locations of the rings.
[rings main] = findRings(main);
% And all data is used to calculate the coordinations of the atoms (and
% bonds).
main = draw(main,1,rings);

%% Centering coordinates
main = centerCoords(main);

%% Drawing
%The function below draws all bonds, and prints data on the screen. When
%the GUI is not being used, this function creates the figure and axes as
%well.
drawMol(main,1,GUI);
end